package view.Bag
{
	import starling.display.Image;
	import starling.display.Sprite;
	import starling.text.TextField;
	import starling.utils.HAlign;
	
	public class ItemView extends Sprite
	{
		private var _num:uint;
		private var _numTxt:TextField;
		private static const LEN:uint = 30;
		private var _prizeImg:Image;
		public function ItemView(prizeImg:Image):void
		{
			_prizeImg = prizeImg;
			addChild(_prizeImg);
			
			drawNumTxt();
		}
		
		private function drawNumTxt():void
		{
			_numTxt = new TextField(LEN, 15, "", "Courier New", 10, 0xffffff, true);
			_numTxt.autoScale = true;
			_numTxt.hAlign = HAlign.RIGHT;
			_numTxt.x = 0;
			_numTxt.y = 40;
			addChild(_numTxt);
		}		
		
/*-----------------------------------getter and setter---------------------------------*/
		/**包里单个物品的个数*/
		public function get num():uint
		{
			return _num;
		}

		public function set num(value:uint):void
		{
			_num = value;
			_numTxt.text = _num;
			
		}

		public function get prizeImg():Image
		{
			return _prizeImg;
		}

		public function set prizeImg(value:Image):void
		{
			_prizeImg = value;
		}


	}
}